;$(function () {

    window.creatZhuChart = function (id, data, xAxis, title, bgcolor) {
        var option = {
            title : {
                //text:title,
                subtext: title,
                x:'center',
                itemGap: 0,
                padding: 0,
                textBaseline:"top"
            },
            itemStyle:{
                normal: {
                    label: {
                        show: true
                    },
                    color:function (params) {
                        var colorList = bgcolor;
                        return colorList[params.dataIndex];
                    }
                }
            },
            tooltip : {
                show:true,
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            grid: {
                top:"25%",
                left: '6%',
                right: '10%',
                bottom: '2%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data : xAxis,
                    axisTick: {
                        alignWithLabel: true
                    }
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'',
                    type:'bar',
                    barWidth: '37',
                    data:data
                }
            ]
        };
        console.log(option);
        //option.xAxis.data = ["online","offline"];
        var barDom = window.document.getElementById(id);
        var myChart = echarts.init(barDom);
        if (option && typeof option === "object") {
            myChart.setOption(option, true);
        }
        return myChart;
    }

});